package com.itnoob.controller;

import com.itnoob.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @author zhoujun
 * @date 2025/3/17 21:20
 */

@RestController
public class PayController {

    @Autowired
    private PayService payForThirdService;

    /**
     *
     * @param id
     * @param amount
     * @param type  WECHATPAY,ALIPAY
     * @return
     */
    @PostMapping("/pay")
    public String  payForThird(@RequestParam("id") String id,
                               @RequestParam("amount") BigDecimal amount,
                               @RequestParam("type")  String type)
    {
        //调用支付服务类的方法,返回支付结果
        return payForThirdService.payForThird(id,amount,type);
    }

}
